package cn.bellychang.queue.bobo.linkedqueue02addlastandremovefirst;

import cn.bellychang.iiterface.bobo.Queue;

/**
 * @author: bellychang
 * @date: 2020/2/10
 */
public class LinkedQueue<E> implements Queue<E> {

    private LinkedList<E> list;

    public LinkedQueue() {
        list = new LinkedList<>();
    }


    @Override
    public int getSize() {
        return list.getSize();
    }

    @Override
    public boolean isEmpty() {
        return list.isEmpty();
    }

    @Override
    public void enqueue(E e) {
        list.addLast(e);
    }

    @Override
    public E dequeue() {
        return list.removeFirst();
    }

    @Override
    public E getFront() {
        return list.getLast();
    }

    @Override
    public String toString() {
        return "LinkedQueue Head {" + list.toString() + "} Tail";
    }
}
